﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>configSystem</title>
    <link rel="stylesheet" type="text/css" href="../themes/bootstrap/easyui.css">
    <link rel="stylesheet" type="text/css" href="../themes/icon.css">
    <link rel="stylesheet" type="text/css" href="../css/common.css">
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script type="text/javascript" src="../js/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../js/easyui-lang-zh_CN.js"></script>
</head>
<body>
    <table id="dg" style="width: 700px; height: 500px;"></table>
    <div id="toolbar" style="padding:2px 5px">
        系统名称: <input class="easyui-textbox cls-search-name" type="text" name="name" />
        <a href="#" class="easyui-linkbutton cls-search" iconcls="icon-search">Search</a>
    </div>
    <script type="text/javascript">
        $(function () {
            var $table = $("#dg");
            var queryParams = {
                "size": function () {
                    return $table.datagrid("getPager").pagination("options").pageSize;
                },
                "current": function () {
                    return $table.datagrid("getPager").pagination("options").pageNumber;
                },
                "condition[name]": function () {
                    return $(".cls-search-name").val();
                }
            };
            //表格绑定
            var dg = $table.datagrid({
                url: '../configSystem',
                method: 'GET',
                toolbar: '#toolbar',
                fit: true,
                pagination: true,
                pagePosition: 'bottom',
                pageNumber: 1,
                pageSize: 20,
                pageList: [20, 30, 40, 50, 100, 200, 500],
                remoteFilter: true,
                rownumbers: true,
                fitColumns: true,
                autoRowHeight: true,
                singleSelect: true,
                checkOnSelect: true,
                selectOnCheck: true,
                loadMsg: 'loading......',
                loadFilter: function (rsp) { //格式化返回数据
                    if (rsp != null && rsp.success == true) {
                        return {
                            "total": rsp.data.total,
                            "rows": rsp.data.records
                        };
                    } else
                        return {
                            "total": 0,
                            "rows": []
                        };
                },
                columns: [
                    [
                        { field: 'id', title: 'id', sortable: false, align: 'center', halign: 'center', width: 100, hidden: true },
                        { field: 'name', title: '名称', sortable: false, align: 'center', halign: 'center', width: 100 },
                        { field: 'desc', title: '描述', sortable: false, align: 'center', halign: 'center', width: 100 }
                    ]
                ],
                queryParams: queryParams
            });

            //查询按钮
            $(".cls-search").click(function () {
                $table.datagrid('reload', queryParams);
            });
        });
    </script>
</body>
</html>